import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
<% if(table.info.is_extends_baseEntity == '1') {  -%>
import { BaseEntity } from 'src/entities/base.entity';
<% } %>
@Entity()
export class <%= className %><% if(table.info.is_extends_baseEntity == '1') {  -%> extends BaseEntity <% } %>{
  <% for(let i = 0; i < table.columns.length; i++) { -%>
    <% if(table.columns[i].is_pk == '1') { %>
    @PrimaryGeneratedColumn({
      type: "<%- table.columns[i].column_type %>",
      <%_ if(table.columns[i].column_length != null){ -%>
      length: <%= table.columns[i].column_length %>,
      <% } -%>
      comment: "<%= table.columns[i].column_comment %>",
    })
    <%= table.columns[i].column_name %>: <%= table.columns[i].js_type %>;
    <% } else { %>
    @Column({
      type: "<%- table.columns[i].column_type %>",
      <%_ if(table.columns[i].column_length != null){ -%>
      length: <%= table.columns[i].column_length %>,
      <% } -%>
      <%_ if(table.columns[i].column_default){ %>
      default: <%= table.columns[i].column_default %>,
      <% } %>
      nullable: <%= table.columns[i].is_nullable == '1' ? true : false %>,
      comment: "<%= table.columns[i].column_comment %>",
    })
    <%= table.columns[i].column_name %>: <%= table.columns[i].js_type %>
    <% } -%>
  <% } %>
}
